package com.lrs.java.j2se_self.net;
import java.io.IOException;
import java.net.*;

public class UDPServer {
	public static void main(String[] args){
		byte[] b = new byte[1024];
		DatagramPacket dp = new DatagramPacket(b,0,b.length);
		try{
			DatagramSocket ds = new DatagramSocket(5678);
			while(true){
				ds.receive(dp);
				System.out.println(new String(b,0,dp.getLength()));
			}
		}catch(SocketException s){
			s.printStackTrace();
		}catch(IOException e){
			e.getMessage();
		}
	}
}
